**Authors:  Roberto Carlos, Geoffrey Sheagley, Karlee Taylor
**Paper:   "Tolerance for the Free Speech of Outgroup Partisans"
**Intent: Initial Data Formatting

use "knight_data_final_clean.dta"

*Party ID

tab QPID100

gen pid3 = QPID100 if QPID100 !=-1

label define pid3 1 "Republican" 2 "Democrat" 3 "Independent" 6 "Other"
label values pid3 pid3
tab pid3

*College Student 

tab Student1

gen college_student = . 
replace college_student = 1 if Student1==1 | Student1==2 | Student1==3
replace college_student = 0 if Student1==4 | Student1==.

tab college_student

tab college_student pid3, col chi


*Race/ethnicity 

tab1  ppethm

*age

tab ppage 

*income 

tab ppinc7

*education 

tab ppeducat

tab ppeducat college_student

*Treatment

tab1 Q7_carlos_split Q5_carlos_split

drop if Q7_carlos_split==-1


**Experiment 1: I would never support restricting free speech

*Outcome 
tab Q58B
tab Q58B, nolab

gen out_speech = Q58B if Q58B != -1
tab out_speech

replace out_speech = out_speech -2 if out_speech > 1 
tab out_speech

*Recode Outcome so that Higher values = greater agreement 
*Be cafeful not to run this command if the variable is already in dataset 
replace out_speech = abs(6-out_speech)
tab out_speech


*Treatment 
gen treat_speech = Q5_carlos_split
tab treat_speech

label define treat_speech 1 "Baseline" 2 "Dems Hurt Others" 3 "Dems Hurt Me" /// 
4 "Repubs Hurt Others" 5 "Repubs Hurt Me" 
label values treat_speech treat_speech
tab treat_speech

*Collapse Threats together 
gen treat_speech_small = . 
replace treat_speech_small = 1 if treat_speech==1
replace treat_speech_small = 2 if treat_speech == 2 | treat_speech == 3
replace treat_speech_small = 3 if treat_speech == 4 | treat_speech == 5

label define treat_speech_small 1 "Baseline" 2 "Dems are Hurtful" 3 "Repubs are Hurtful"
label values treat_speech_small treat_speech_small 
tab treat_speech_small

tab treat_speech_small treat_speech


**Experiment #2: Campus Speech 

*Outcome 

tab Q60B
tab Q60B, nolab

gen out_campus = Q60B if Q60B != -1
tab out_campus

replace out_campus = out_campus -2 if out_campus > 1 

replace out_campus = abs(6-out_campus)

*Treatments

gen treat_campus = Q7_carlos_split

label define treat_campus 1 "Baseline" 2 "Liberal Perspectives Only" 3 "Liberal Perspectives + Threat" 4 "Conservative Perspectives Only" 5 "Conservative Perspectives + Threat"

label values treat_campus treat_campus

gen treat_campus_small  = . 
replace treat_campus_small = 1 if treat_campus==1
replace treat_campus_small = 2 if treat_campus==2 | treat_campus==3 
replace treat_campus_small = 3 if treat_campus==4 | treat_campus==5 

label define treat_campus_small 1 "Baseline" 2 "Liberal Perspectives" 3 "Conservative Perspectives"
label values treat_campus_small treat_campus_small
tab  treat_campus treat_campus_small

keep treat_campus_small treat_campus out_campus treat_speech_small treat_speech out_speech college_student pid3 case_id ppinc7 ppethm ppage  ppeducat Main_Weights

save "knight_data_final_formatted.dta", replace


